//
//  CheckersHumanPlayer.m
//  CheckersGame
//
//  Created by Guest User on 11-12-14.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "CheckersHumanPlayer.h"

@implementation CheckersHumanPlayer

@synthesize playerName;

-(id) init {
    self = [super init];
    if (self ){
        waitingForMove = YES;
        isPaused = NO;
    }
    return self;
}

-(BOOL) decideMove : (CheckersMove*) move Board:  (CheckersBoard*) board{
    if (!waitingForMove){
        memcpy(move, &self->move, sizeof(CheckersMove));
        waitingForMove = YES;
        return YES;
    }
    return NO;
}
-(BOOL) needsPieceInteraction {
    return !isPaused && waitingForMove;
}

-(void) overrideNextMove : (CheckersMove*) move{
    move->isjump =
        abs(move->from.x - move->to.x) > 1 || abs(move->from.y - move->to.y) > 1;
        
    memcpy(&self->move, move, sizeof(CheckersMove));
    waitingForMove = NO;
}

-(void) setPaused : (BOOL) paused {
    isPaused = paused;
}


-(void) invalidateNextMove{
    waitingForMove = NO;
}
@end
